<?php


namespace App\Admin\Actions\Post;


use App\Admin\Actions\RowAction;
use App\BookApply;
use Illuminate\Http\Request;

class BookGrantPost extends RowAction
{
    public $name = '已授权';

    public function handle(BookApply $model, Request $request)
    {
        $model->status = 1;
        $model->name = $request->get('name');
        $model->register_no = $request->get('register_no');
        $model->complete_date = $request->get('complete_date');;
        $model->save();
        return $this->response()->swal()->success('操作成功')->refresh();
    }

    public function form()
    {
        $model = $this->row;
        $this->text('name', __('名称'))->default($model->name);
        $this->text('register_no', __('登记号'))->required();
        $this->date('complete_date', __('完成日期'))->required();
    }

}
